<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <title>礼品卡生成登录</title>
    <script src="/assets/index/js/jquery-3.2.1.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="/assets/index/style/SignIn.css" />
    <script src="/assets/layer/layer.js"></script> 
</head>

<body>
    <div class="signIn">
        <div class="card">
            <!-- <img class="card_left" src="/assets/index/img/right.jpg" alt=""> -->
            <div class="card_right">
                <div class="card_right_header">
                    <!-- <p id="title1" style="display: none;">免费注册</p> -->
                    <!-- <p id="title2" style="display: none;">忘记密码</p> -->
                    <p id="title3" style="display: block;">账号登录</p>
                    <div></div>
                </div>
                <div class="card_right_form">
                    <!-- 注册 -->
                    <!-- <form id="form1" style="display: none;">
                        <input class="input_text" type="text" placeholder="请输入手机号码" />
                        <div class="input_flex">
                            <input class="input_yan" type="text" placeholder="请输入验证码" />
                            <input class="input_yanbtn" type="button" value="获取验证码" />
                        </div>
                        <input class="input_text" type="password" placeholder="请输入密码" />
                        <p class="card_right_form_p1">注册即代表您同意<a href="">《机械设计云平台隐私协议》</a></p>
                        <input class="input_btn1 input_btn2" type="button" value="立即注册" />
                        <p class="card_right_form_p2">已有账号，立即登录</p>
                    </form> -->

                    <!-- 忘记密码 -->
                    <!-- <form id="form2" style="display: none;">
                        <input class="input_text" type="text" placeholder="请输入手机号码" />
                        <div class="input_flex">
                            <input class="input_yan" type="text" placeholder="请输入验证码" />
                            <input class="input_yanbtn" type="button" value="获取验证码" />
                        </div>
                        <input class="input_text" type="password" placeholder="请输入新密码" />
                        <input class="input_btn1 input_btn3" type="button" value="保存" />
                        <p class="card_right_form_p2">又想起来了</p>
                    </form> -->

                    <!-- 登录 -->
                    <form id="form3">
                        {:token()}
                        <input class="input_text" id="username" type="text" placeholder="请输入账号" />
                        <input class="input_text" id="password" type="password" placeholder="请输入密码" />
                        <!-- <p class="card_right_form_p2">忘记密码</p> -->
                        <input class="input_btn1 input_btn4" type="button" onclick="sub()" value="登录" />
                        <!-- <input class="input_btn1 input_btn5" type="button" value="免费注册" /> -->
                    </form>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript">
    
    function Rem() {
        let html = document.documentElement;

        let wW = html.clientWidth; // 窗口宽度

        console.log(wW)

        if (wW <= 750) {
            var designSize = 750; // 设计图尺寸
            $(".card_left").addClass("card_left375");
            $(".card_right").addClass("card_right375");
        } else {
            var designSize = 1920; // 设计图尺寸
            $(".card_left").removeClass("card_left375");
            $(".card_right").removeClass("card_right375");
        }

        console.log(designSize)

        let rem = wW * 100 / designSize;
        // if (rem < 70) {
        //     document.documentElement.style.fontSize = 70 + 'px';
        // } else {
        //     document.documentElement.style.fontSize = rem + 'px';
        // }
        document.documentElement.style.fontSize = rem + 'px';
        // console.log(rem)
    }
    window.addEventListener('resize', Rem, false);
    Rem();

    function sub()
    {
        var username=$("#username").val();
        var password=$("#password").val();
        var token=$('input[name="__token__"]').val();  
        // alert(username);
        console.log(username);
        $.ajax({
            dataType: 'json',
            type: 'POST',
            url: '/index/user/login',
            data: {account:username,password:password,__token__:token},
            success: function (data) {
                console.log(data);
                console.log(data.code);
                if (data.code == 0) {
                    layer.msg(data.msg);
                } else {
                    layer.msg(data.msg);
                    setTimeout(function(){
                        window.location.href='/';
                    }, 1000);
                }
            },
            error: function (jqXHR, textStatus, errorThrown) {
                layer.close(index); // 关闭加载层  
            }
        });
    }
</script>

</html>